<?php 
## include required files
/*******************************/
require_once '../model/blogs.php';
require_once '../model/users.php';
/*******************************/
## Create Objects
/*******************************/
$blogObj = new Model_Blogs();
$userObj = new Model_Users();
/*******************************/

if($_GET['id']!='') {
	$blog_id = base64_decode($_GET['id']);

	## Get blog details by id
	$blogArray = $blogObj->getblogDetailsById($blog_id);
	
	/************** Get user Details By whom added the blog *****************/
	$user_id = $blogArray['user_id'];
	if($user_id==1)	{
		$user_name = 'Admin';
	} else {
		$user_name = $userObj->getUserNameByUserId($user_id);
	}
	
	$smarty->assign('user_name', $user_name);
	/**************End For Get user Details By whom added the blog****************/
	$smarty->assign('blogArray', $blogArray);
}

## Set active class variable for left menu
$smarty->assign('activeclass', 'blogs');
$smarty->assign('mainmenu', '3');

## Unset all the objects created which are on this page
unset($blogObj);
unset($userObj);

$smarty->display(TEMPLATEDIR_ADMIN. 'blogs/blogdetails.tpl');
unset($smarty);
?>